﻿<!DOCTYPE HTML>
<html lang="en-US">

<head>
    <meta charset="UTF-8"/>
    <title>ueditor demo</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" />
    <style type="text/css">
        label{
            font-size:15px;
            display: block;
        }
        #container{
            width:90%;
            margin: 0 auto;
        }
    </style>
</head>

<body>
<!--头部-->
<form role="form" style="width: 90%; margin: 0 auto;">
    <label style="display:inline-block;">网站类型:</label>
    <span name="typename" id="typename"></span>

    <label>网站标题:</label>
    <div class="form-group">
        <textarea class="form-control" rows="1" style="height: 35px;" id="title"></textarea>
    </div>
    <label>内容摘要:</label>
    <div class="form-group">
        <textarea class="form-control" rows="2" id="summary"></textarea>
    </div>

</form>

<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">
        这里写你的初始化内容
 </script>
<!-- 配置文件 -->
<!--<script type="text/javascript" src="uedi入新闻标题：nfig.js"></script>-->
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>

<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>


<script type="text/javascript">
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
            return 'http://localhost:8080/imgUpload';
            //'http://localhost:8080/imgUpload';为方法imgUpload的访问地址
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    }
</script>
<button type="button" class="btn btn-default" style="float:right; margin-right: 5%;margin-top: 5px;" onclick="submintcontent()">提交</button>
</body>
<script type="text/javascript" src="js/jquery-1.11.3.js"></script>
<script th:inline="javascript">
    window.onload=function(){
//        var searchid=sessionStorage.getItem("searchid");
//        var str=sessionStorage[searchid];
//        var message=JSON.parse(str);
////        var ue = UE.getEditor('container');
//        // var newTime=new Date(message.createTime);
//        // var date=newTime.toLocaleDateString() + " " + newTime.toLocaleTimeString();
//        $("#title").val(message.title);
//        $("#summary").val(message.summary);
//        $("#typename").html(message.companyIntroductionType.name);
//        // $("#content").html(message.htmlContent);
////        ue.setContent(message.htmlContent);
        var value = prompt('插入html代码', '');
        ue.execCommand('insertHtml',value);
        alert(message.htmlContent);
//        alert(message.htmlContent);



    };

</script>

</html>